from rest_framework import status
from rest_framework.exceptions import APIException
from django.utils.translation import gettext_lazy as _


class PhoneHasBindError(APIException):
    status_code = status.HTTP_202_ACCEPTED
    default_detail = _('该手机号已被绑定。')
    default_code = 'invalid'


class EmailHasBindError(APIException):
    status_code = status.HTTP_202_ACCEPTED
    default_detail = _('该邮箱已被绑定。')
    default_code = 'invalid'


class SmsTimeOutError(APIException):
    status_code = status.HTTP_404_NOT_FOUND
    default_detail = _('验证码已失效。')
    default_code = 'not_found'


class SmsError(APIException):
    status_code = status.HTTP_404_NOT_FOUND
    default_detail = _('验证码错误。')
    default_code = 'not_found'
